//
//  DSZTJXQTableViewCell.m
//  7.13苏宁框架
//
//  Created by app15 on 15/7/23.
//  Copyright (c) 2015年 lovena. All rights reserved.
//

#import "DSZTJXQTableViewCell.h"
#import "DSZTJXQCell.h"
#import "DSZTJShowModel.h"
#import "UIImageView+WebCache.h"
#import "DSZTJCommentModel.h"
#import "MJExtension.h"
NSArray *cellmodel;
NSInteger numberCell;
@interface DSZTJXQTableViewCell()<UITableViewDataSource,UITableViewDelegate>

@end
@implementation DSZTJXQTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

-(void)cellmodel:(DSZTJShowModel*)TJXQModel number:(NSInteger)num{
    NSDictionary *dic=[TJXQModel keyValues];
    NSArray *array=dic[@"comment"];
    NSArray *model=[DSZTJCommentModel modelArrayWithDictArray:array];
    cellmodel=model;
    numberCell=num;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self=[[[NSBundle mainBundle]loadNibNamed:@"DSZTJXQTableViewCell" owner:nil options:nil]lastObject];
    }
    return self;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return numberCell;
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    NSString *ID=@"cell";
    DSZTJCommentModel *model=cellmodel[indexPath.row];
    DSZTJXQCell *cell=[tableView dequeueReusableCellWithIdentifier:ID];
    if (cell==nil) {
        cell=[[DSZTJXQCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
   // cell.image
    NSString *str=model.name;
    CGFloat i=str.length;
    CGRect len=cell.namelabel.frame;
    CGRect len1=cell.intorLabel.frame;
    len=CGRectMake(cell.namelabel.frame.origin.x, cell.namelabel.frame.origin.y, 10+i*15, cell.namelabel.frame.size.height);
    len1=CGRectMake(cell.namelabel.frame.origin.x+10+i*15, cell.intorLabel.frame.origin.y,cell.intorLabel.frame.size.width, cell.intorLabel.frame.size.height);
    cell.intorLabel.frame=len1;
    cell.namelabel.frame=len;
    [cell.image setImageWithURL:[NSURL URLWithString:model.image]];
    cell.namelabel.text=[NSString stringWithFormat:@"%@:",model.name];
    cell.intorLabel.text=model.content;
   // cell.namelabel.text=
    return cell;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
